	/**
	 * google: UP5vh5NZ8hT3
	 * MUNIRUL HODA
	 * CS 340 PROJECT 1 FALL 12(MY_PLACE Store)
	 */


public class MY_PLACE {
	public static long time = System.currentTimeMillis();
	
	static int noOfCustomers = 10;
	static int noOfFloorClerks = 3;
	static int noOfCashiers = 2;
	
	static Cashier Cash_Cashier = new Cashier("<CASH>");
	static Cashier CC_Cashier = new Cashier("<CC>");
	
	
	public static void main(String[] args) {
		
		try {
			if (args.length >= 1 ){
				noOfCustomers = Integer.parseInt(args[0]);
				if (args.length >= 2 ){
					noOfFloorClerks = Integer.parseInt(args[1]);
					if (args.length >= 3 ){
						if(Integer.parseInt(args[2]) != 2)
							System.out.println("There can only be 2 Cashiers");
					}
				}
			}

	    } catch (NumberFormatException e) {
	        System.err.println("ERROR: Arguments must be integers");
	        System.exit(1);
	    }

		
		System.out.println(noOfCustomers);
		System.out.println(noOfFloorClerks);
		System.out.println(noOfCashiers);
		System.out.println(500 + (int)(Math.random() * (5000 - 500)));
/*		Thread[] cashierThreads = new Thread[noOfCashiers];
		for (int i = 0; i < noOfCashiers; i++)
		{
			cashierThreads[i] = new Cashier();
			cashierThreads[i].start();
		}
*/
		
		Cash_Cashier.start();
		CC_Cashier.start();
		
		FloorClerk[] floorClerkThreads = new FloorClerk[noOfFloorClerks];
		for (int i = 0; i < noOfFloorClerks; i++)
		{
			floorClerkThreads[i] = new FloorClerk();
			floorClerkThreads[i].start();
		}

		Customer[] customerThreads = new Customer[noOfCustomers];
		for (int i = 0; i < noOfCustomers; i++)
		{
			customerThreads[i] = new Customer();
			customerThreads[i].start();
		}


/*		

	public static void sendTruckBack(Truck t) {
		if (t.partType == "BROOM")
			broomManThread.truckReturns(t);
		else if (t.partType == "HEAD")
			headManThread.truckReturns(t);
		else if (t.partType == "TORSO")
			torsoManThread.truckReturns(t);
		else if (t.partType == "HAND")
			handsManThread.truckReturns(t);
		else if (t.partType == "LEG")
			legsManThread.truckReturns(t);
	}
	
	
	public static int indexOfMax(int[] t) {
	    int maximum = t[0];   
	    int maxIndex = 0;
	    for (int i=1; i<t.length; i++) {
	        if (t[i] > maximum) {
	            maximum = t[i];   
	            maxIndex = i;
	        }
	    }
	    return maxIndex; */
	}
	
	public static void acceptCustomer(Customer customer) {
		if((customer.getPaymentType()).equals("CREDIT CARD"))
			CC_Cashier.customerQue.addElement(customer);
		else
			Cash_Cashier.customerQue.addElement(customer);
	}

}

/*                                                   YET TO DO
 * You should keep the concurrency of the threads as high as possible. using the sleep
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 * 
 */

